
var imgArray = new Array();
imgArray[0] = "http://images.ticat.co.kr/img/0.gif";
imgArray[1] = "http://images.ticat.co.kr/img/1.gif";
imgArray[2] = "http://images.ticat.co.kr/img/2.gif";
imgArray[3] = "http://images.ticat.co.kr/img/3.gif";
imgArray[4] = "http://images.ticat.co.kr/img/4.gif";
imgArray[5] = "http://images.ticat.co.kr/img/5.gif";
imgArray[6] = "http://images.ticat.co.kr/img/6.gif";
imgArray[7] = "http://images.ticat.co.kr/img/7.gif";
imgArray[8] = "http://images.ticat.co.kr/img/8.gif";
imgArray[9] = "http://images.ticat.co.kr/img/9.gif";

function dayCount(days, hrs, mins, secs){
	
	if(days > 0){
		hrs = days*24+hrs;
	}

	discountTimer(days, hrs, mins, secs);

}

function discountTimer(days, hrs, mins, secs) { 


    secs    = secs - 1; 

    if(secs == -1) 
    { 
        secs    = 59; 
        mins    = mins - 1; 
    } 

    if(mins == -1) 
    {                                              
        mins    = 59; 
        hrs    = hrs - 1; 
    } 

    if(hrs == -1) 
    {                                              
        hrs    = 23; 
        days    = days - 1; 
    } 

    if(secs == 0 && mins == 0 && hrs == 0 && days == 0) 
    { 
        document.getElementById('time_table').style.display = 'none';      
		document.getElementById('time_end').style.display = 'block'; 
		document.getElementById('orderImg_2').style.display = 'block'; 
		document.getElementById('orderImg_1').style.display = 'none';
		document.getElementById('percent_pop').style.display = 'none'; 
		
        return; 
    } 

    days     += ''; 
    hrs    += ''; 
    mins    += ''; 
    secs    += ''; 

    days    = (days.length==1)    ? '0'+days    : days; 
    hrs    = (hrs.length==1)    ? '0'+hrs    : hrs; 
    mins    = (mins.length==1)    ? '0'+mins    : mins; 
    secs    = (secs.length==1)    ? '0'+secs    : secs; 

	for (i = 0; i < hrs.length; i++) {		
		//alert(i);
       document.getElementById("hours" + i).src = imgArray[parseInt(hrs.charAt(i))];
    }

	for (i = 0; i < mins.length; i++) {
		document.getElementById("minutes" + i).src = imgArray[parseInt(mins.charAt(i))];
	}

	for (i = 0; i < secs.length; i++) {
		document.getElementById("seconds" + i).src = imgArray[parseInt(secs.charAt(i))];    
    }


   // document.getElementById(dest).innerHTML = dd + '일 ' + hh + '시간 ' + mins + '분 ' + secs + '초'; 
	window.setTimeout("discountTimer("+days+","+hrs+","+mins+","+secs+")",1000); 

 //   window.setTimeout(discountTimer(days,hrs,mins,secs),1000); 
}